//
//  CompanyCZTableViewCell.m
//  u76ho
//
//  Created by m-air-01 on 16/1/6.
//  Copyright © 2016年 LV. All rights reserved.
//

#import "CompanyCZTableViewCell.h"
#import "CompanyDetailModel.h"
@implementation CompanyCZTableViewCell

- (void)awakeFromNib {
    // Initialization code
    _firstImgV.layer.masksToBounds = YES;
    _firstImgV.layer.cornerRadius = _firstImgV.frame.size.width/2;
    
    _secondImgV.layer.masksToBounds = YES;
    _secondImgV.layer.cornerRadius = _secondImgV.frame.size.width/2;
    
    _thirdImgV.layer.masksToBounds = YES;
    _thirdImgV.layer.cornerRadius = _thirdImgV.frame.size.width/2;
    
    
    _firstDescriLab.hidden = YES;
    _firstImgV.hidden = YES;
    _firstNameLab.hidden = YES;
    
    _secondImgV.hidden = YES;
    _secondNameLab.hidden = YES;
    _secondDescriLab.hidden = YES;
    
    _thirdDescriLab.hidden = YES;
    _thirdImgV.hidden = YES;
    _thirdNameLab.hidden = YES;

    
}
-(void)setDataArr:(NSArray *)dataArr
{
    
    _firstDescriLab.hidden = NO;
    _firstImgV.hidden = NO;
    _firstNameLab.hidden = NO;
    
    _secondImgV.hidden = NO;
    _secondNameLab.hidden = NO;
    _secondDescriLab.hidden = NO;
    
    _thirdDescriLab.hidden = NO;
    _thirdImgV.hidden = NO;
    _thirdNameLab.hidden = NO;

    
    if (dataArr.count == 1) {
        CompanyDetailRenqiModel * modelO = dataArr.firstObject;
        [_firstImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,modelO.headpic]] placeholderImage:[UIImage imageNamed:@"公司简介成长－默认头像"]];
        _firstNameLab.text = modelO.username;
        _firstDescriLab.text = modelO.name;
        
        _secondImgV.hidden = YES;
        _secondNameLab.hidden = YES;
        _secondDescriLab.hidden = YES;
        
        _thirdDescriLab.hidden = YES;
        _thirdImgV.hidden = YES;
        _thirdNameLab.hidden = YES;
        
    }
    else if (dataArr.count == 2)
    {
        CompanyDetailRenqiModel * modelO = dataArr.firstObject;
        [_firstImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,modelO.headpic]] placeholderImage:[UIImage imageNamed:@"公司简介成长－默认头像"]];
        _firstNameLab.text = modelO.username;
        _firstDescriLab.text = modelO.name;
        
        CompanyDetailRenqiModel * modelT = dataArr[1];
        [_secondImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,modelT.headpic]] placeholderImage:[UIImage imageNamed:@"公司简介成长－默认头像"]];
        _secondNameLab.text = modelT.username;
        _secondDescriLab.text = modelT.name;
        
        _thirdDescriLab.hidden = YES;
        _thirdImgV.hidden = YES;
        _thirdNameLab.hidden = YES;
    }
    else
    {
        CompanyDetailRenqiModel * modelO = dataArr.firstObject;
        [_firstImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,modelO.headpic]] placeholderImage:[UIImage imageNamed:@"公司简介成长－默认头像"]];
        _firstNameLab.text = modelO.username;
        _firstDescriLab.text = modelO.name;
        
        CompanyDetailRenqiModel * modelT = dataArr[1];
        [_secondImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,modelT.headpic]] placeholderImage:[UIImage imageNamed:@"公司简介成长－默认头像"]];
        _secondNameLab.text = modelT.username;
        _secondDescriLab.text = modelT.name;

        
        CompanyDetailRenqiModel * modelS = dataArr.lastObject;
        [_thirdImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,modelS.headpic]] placeholderImage:[UIImage imageNamed:@"公司简介成长－默认头像"]];
        _thirdNameLab.text = modelS.username;
        _thirdDescriLab.text = modelS.name;
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
